package com.example.chatzsyproject.ui;

import android.content.Intent;
import android.os.Bundle;
import android.view.View;
import android.widget.EditText;
import android.widget.ImageButton;
import android.widget.ImageView;
import android.widget.TextView;

import androidx.recyclerview.widget.LinearLayoutManager;
import androidx.recyclerview.widget.RecyclerView;

import com.chad.library.adapter.base.BaseQuickAdapter;
import com.example.chatzsyproject.R;
import com.example.chatzsyproject.adapter.ApplyListAdapter;
import com.example.chatzsyproject.base.BaseActivity;
import com.example.chatzsyproject.model.ApplyListBean;
import com.example.chatzsyproject.view.AZListView.azlist.AZTitleDecoration;
import com.j256.ormlite.stmt.query.In;

import java.util.ArrayList;
import java.util.List;

import butterknife.BindView;
import butterknife.ButterKnife;

public class ApplyListActivity extends BaseActivity {

    @BindView(R.id.im_left)
    ImageView imLeft;
    @BindView(R.id.tv_title)
    TextView tvTitle;
    @BindView(R.id.im_right)
    ImageView imRight;
    @BindView(R.id.query)
    EditText query;
    @BindView(R.id.search_clear)
    ImageButton searchClear;
    @BindView(R.id.recyclerView)
    RecyclerView recyclerView;
    private ApplyListAdapter applyListAdapter;
    private List<ApplyListBean> applyListBeans;

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_apply_list);
        ButterKnife.bind(this);

        initDate();
        initListener();
    }

    private void initDate() {
        applyListBeans = new ArrayList<>();
        for (int i=0;i<15;i++){
            applyListBeans.add(new ApplyListBean());
        }
        recyclerView.setLayoutManager(new LinearLayoutManager(this));
        recyclerView.addItemDecoration(new AZTitleDecoration(new AZTitleDecoration.TitleAttributes(this)));
        applyListAdapter = new ApplyListAdapter(R.layout.item_apply_list, applyListBeans);
        recyclerView.setAdapter(applyListAdapter);
    }

    private void initListener() {
        imLeft.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View v) {
                ApplyListActivity.this.finish();
            }
        });

        imRight.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View v) {
                //跳转添加好友界面
            }
        });

        applyListAdapter.setOnItemClickListener(new BaseQuickAdapter.OnItemClickListener() {
            @Override
            public void onItemClick(BaseQuickAdapter adapter, View view, int position) {
                Intent intent = new Intent(ApplyListActivity.this,ProcessingaApplyActivity.class);
                startActivity(intent);
            }
        });
    }
}
